from django.db import models
from login.models import User


# Create your models here.

class Answer(models.Model):
    date = models.DateField('date_answer')  # 问卷的填写时间
    user = models.ForeignKey(User, on_delete=models.CASCADE)

    self_health_choice = (
        (1, '身体健康，无异常'),
        (2, '有出现发热、乏力、呼吸困难等与新冠肺炎相关症状'),
        (3, '有其他疾病症状'),
    )
    # 家人健康
    family_health_choice = (
        (1, '无'),
        (2, '有')
    )
    # 工作情况
    work_state_choice = (
        (1, '正常上班'),
        (2, '正常轮休，没有上班'),
        (3, '其他原因，没有上班'),
    )
    # 工作环境
    work_evironment_choice = (
        (1, '干净整洁、通风良好、环境舒适'),
        (2, '还需要进一步整治或改善'),
    )
    # 心理健康
    mental_health_choice = (
        (1, '沟通渠道畅通，工作心情愉快'),
        (2, '找不到人倾诉，需要关心帮助'),
    )

    # 特殊情况
    self_health = models.IntegerField(default=1, choices=self_health_choice, null=False)
    family_health = models.IntegerField(default=1, choices=family_health_choice, null=False)
    work_state = models.IntegerField(default=1, choices=work_state_choice, null=False)
    work_evironment = models.IntegerField(default=1, choices=work_evironment_choice, null=False)
    mental_health = models.IntegerField(default=1, choices=mental_health_choice, null=False)
    special_case = models.CharField(max_length=30, null=True)

    def __str__(self):
        return str(self.date)
